package com.yuerlive.paperplane.data.source.datasource;

import android.arch.persistence.room.Entity;
import android.arch.persistence.room.TypeConverters;
import android.support.annotation.NonNull;

import com.yuerlive.paperplane.data.ZhihuDailyNewsQuestion;
import com.yuerlive.paperplane.database.StringTypeConverter;

import java.util.List;

/**
 * Created by Admin on 2017/10/12.
 */
@Entity(tableName = "zhihu_daily_news")
@TypeConverters(StringTypeConverter.class)
public interface ZhihuDailyNewsDataSource {
    interface loadZhihuDailyNewsCallback{
        void onNewsLoad(@NonNull List<ZhihuDailyNewsQuestion> list);
        void onDataNotAvailable();
    }
    interface GetNewsItemCallback{
        void onItemLoaded(@NonNull ZhihuDailyNewsQuestion item);
        void onDataNotAvailable();
    }
    void getZhihuDailyNews(boolean forceUpdate, boolean clearCache, long date,
                           @NonNull loadZhihuDailyNewsCallback callback);
    void getFavorites(@NonNull loadZhihuDailyNewsCallback callback);
    void getItem(int itemId, @NonNull GetNewsItemCallback callback);
    void favoriteItem(int itemId, boolean favorite);
    void saveAll(@NonNull List<ZhihuDailyNewsQuestion> list);
}
